<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html lang="zh-CN">
<head>
<meta content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" name="viewport" />
<meta charset="utf-8">
<title>${skin.name }-${skin.id }</title>
<style type="text/css">
td, th {
	padding: 10px;
}

#skin_content {
	width: 99%;
	height: 350px;
	background-color: #eee;
}

#btnSave {
	padding: 10px;
}
</style>
</head>
<body>
	<h4>${skin.name }(${skin.id })</h4>
	<textarea id="skin_content" placeholder='例：{"view_id":{"width":30}}'>${skin.content }</textarea>
	<div style="margin-top: 10px;">
		<button id="btnSave">保存</button>
	</div>
	<script type="text/javascript" src="static/jquery-1.11.0.js"></script>
	<script type="text/javascript">
		$(function() {
			$("#btnSave").click(function() {
				var p = {
					t : new Date(),
					id : "${skin.id}",
					content : $("#skin_content").val().trim()
				};
				try {
					eval("(" + p.content + ")");
				} catch (e) {
					alert("内容格式不正确");
					return;
				}
				$.post("skin_save.htm", p, function(data) {
					alert(JSON.stringify(data));
				}, "json");
			});
		});
	</script>
</body>
</html>